package com.hyt.it.ogt.pj.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hyt.core.base.BaseServiceImpl;
import com.hyt.it.ogt.pj.mapper.MarkDataCacheMapper;
import com.hyt.it.ogt.pj.model.entity.MarkDataCache;
import com.hyt.it.ogt.pj.service.IMarkDataCacheService;

@Service
public class MarkDataCacheServiceImpl extends BaseServiceImpl<MarkDataCacheMapper, MarkDataCache> implements IMarkDataCacheService {

    @Autowired
    private MarkDataCacheMapper markDataCacheMapper;

    @Override
    public boolean replaceIntoCache(String examId, String officeId) {
        MarkDataCache markDataCache = new MarkDataCache();
        LocalDateTime nowTime = LocalDateTime.now();
        markDataCache.setOfficeId(officeId)
                .setAllowDelete(false)
                .setId(examId)
                .setUpdateDate(nowTime);
        return markDataCacheMapper.replaceIntoCache(markDataCache);
    }

    @Override
    public List<MarkDataCache> getCache() {
        return markDataCacheMapper.getCache();
    }

}
